﻿#region

using System;
using System.Collections.Generic;
using System.Linq;
using Domain;

#endregion

namespace Testss {
    internal class Create {
        public static Graph<HyperEdge> MAcyclicHyperGraph {
            get {
                var vertices = new Vertex[9];
                for (var i = 0; i < 9; i++) {
                    vertices[i] = new Vertex(i);
                }
                return new Graph<HyperEdge>(vertices.ToList())
                    .AddEdge(new HyperEdge(vertices[0], vertices[1], vertices[5], vertices[6]))
                    .AddEdge(new HyperEdge(vertices[2], vertices[6]))
                    .AddEdge(new HyperEdge(vertices[3], vertices[6], vertices[7]))
                    .AddEdge(new HyperEdge(vertices[3], vertices[4], vertices[8]))
                    .AddEdge(new HyperEdge(vertices[3], vertices[4], vertices[7]));
            }
        }

        public static Graph<HyperEdge> MCyclingHyperGraph {
            get {
                var graph = new Graph<HyperEdge>(16);
                var v = graph.Vertices;

                return graph
                    .AddEdge(new HyperEdge(v[0], v[1], v[2], v[3], v[4], v[5]))
                    .AddEdge(new HyperEdge(v[5], v[6], v[7]))
                    .AddEdge(new HyperEdge(v[4], v[6], v[8]))
                    .AddEdge(new HyperEdge(v[7], v[8], v[9], v[10], v[11], v[12]))
                    .AddEdge(new HyperEdge(v[13], v[15]))
                    .AddEdge(new HyperEdge(v[14], v[15]))
                    .AddEdge(new HyperEdge(v[12], v[13], v[14]));
            }
        }

        public static Graph<HyperEdge> MRecudedCyclingHyperGraph {
            get {
                const int numberVertices = 16;
                var list = new List<Vertex>();
                var vertices = new Vertex[numberVertices];
                var ints = new[] {4, 5, 6, 7, 8, 12, 13, 14, 15};
                for (var i = 0; i < numberVertices; i++) {
                    vertices[i] = new Vertex(i, (i+1).ToString());
                    if (!ints.Contains(i)) {
                        continue;
                    }
                    list.Add(vertices[i]);
                }
                var graph = new Graph<HyperEdge>(list);
                var v = vertices;

                return graph
                    .AddEdge(new HyperEdge(v[4], v[5]))
                    .AddEdge(new HyperEdge(v[5], v[6], v[7]))
                    .AddEdge(new HyperEdge(v[4], v[6], v[8]))
                    .AddEdge(new HyperEdge(v[7], v[8], v[12]))
                    .AddEdge(new HyperEdge(v[13], v[15]))
                    .AddEdge(new HyperEdge(v[14], v[15]))
                    .AddEdge(new HyperEdge(v[12], v[13], v[14]));
            }
        }
        public static Graph<HyperEdge> TriangulatedGraph
        {
            get {
                var graph = new Graph<HyperEdge>(5);
                var v = graph.Vertices;

                return graph
                    .AddEdge(new HyperEdge(v[0], v[1]))
                    .AddEdge(new HyperEdge(v[1], v[3]))
                    .AddEdge(new HyperEdge(v[3], v[4]))
                    .AddEdge(new HyperEdge(v[4], v[0]))

                    .AddEdge(new HyperEdge(v[0], v[2]))
                    .AddEdge(new HyperEdge(v[1], v[2]))
                    .AddEdge(new HyperEdge(v[3], v[2]))
                    .AddEdge(new HyperEdge(v[4], v[2]))

                    .AddEdge(new HyperEdge(v[0], v[3]));
            }
        }

        public static Graph<HyperEdge> B1MCyclicHyperGraph {
            get {
                var d = new Dictionary<int, Vertex> {
                                                        {5, new Vertex(5)},
                                                        {6, new Vertex(6)},
                                                        {7, new Vertex(7)},
                                                        {8, new Vertex(8)},
                                                        {9, new Vertex(9)}
                                                    };
                var graph = new Graph<HyperEdge>(d.Values.ToList());
                graph
                    .AddEdge(new HyperEdge(d[5], d[6]))
                    .AddEdge(new HyperEdge(d[6], d[7], d[8]))
                    .AddEdge(new HyperEdge(d[5], d[7], d[9]))
                    .AddEdge(new HyperEdge(d[8], d[9]));

                return graph;
            }
        }
    }
}